package com.ydh.company.service.impl;

import com.ydh.company.dto.ResponseData;
import com.ydh.company.dto.ResultData;
import com.ydh.company.mapper.InfoManagementMapper;
import com.ydh.company.pojo.Condition;
import com.ydh.company.pojo.User;
import com.ydh.company.service.InfoManagementService;
import io.swagger.annotations.ApiParam;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author: elite
 * @data:2020/5/6 9:16
 * 描述：信息管理 mapper
 */
@Service
@SuppressWarnings("all")
public class InfoManagementServiceImpl implements InfoManagementService {

    @Autowired
    private InfoManagementMapper infoManagementMapper;

    @Override
    public User showPersonInfo(User user) {
        return infoManagementMapper.showPersonInfo(user);
    }

    @Override
    public ResultData editPersonInfo(String username, String userAccount, String deptName, String jobName, String tel) {
        String deptId = infoManagementMapper.checkDeptIdByDeptName(deptName);
        String jobId = infoManagementMapper.checkJobIdByJobName(jobName);
        if (infoManagementMapper.editPersonInfo(username,userAccount,deptId,jobId,tel)==0) {
            return ResponseData.error(1001,"编辑失败！");
        }
        return ResponseData.success("");
    }

    @Override
    public List<User> checkUserByCondition(Condition condition) {
        return null;
    }
}
